import { IDomWH } from "@/interface/common";
import { Vector2 } from "three";



/**
 * 将window中的鼠标坐标转化为3D中的鼠标鼠标
 * @param mouse 鼠标的x,y坐标
 * @param domParams  dom元素的宽高
 * @returns 在3D中坐标系的坐标
 */
export const windowMouseTo3DMouse = (mouse: Vector2, domParams: IDomWH): Vector2 => {
    let _mouse = mouse;
    _mouse.set((_mouse.x / domParams.width) * 2 - 1, -(_mouse.y / domParams.height) * 2 + 1);
    return _mouse
}